#include <stdio.h>

int a[513][513];
int sz;
int id;

void Foo(int x, int y) {
    if ((y > 1) && (x < sz) && (a[x][y-1] == -1) && (a[x+1][y-1] == -1) && (a[x+1][y] == -1)) {
        a[x][y-1] = id;
        a[x+1][y-1] = id;
        a[x+1][y] = id;
        ++id;
    }

    if ((y < sz) && (x > 1) && (a[x-1][y] == -1) && (a[x-1][y+1] == -1) && (a[x][y+1] == -1)) {
        a[x-1][y] = id;
        a[x-1][y+1] = id;
        a[x][y+1] = id;
        ++id;
    }

    if ((y < sz) && (x < sz) && (a[x+1][y] == -1) && (a[x+1][y+1] == -1) && (a[x][y+1] == -1)) {
        a[x+1][y] = id;
        a[x+1][y+1] = id;
        a[x][y+1] = id;
        ++id;
    }

    if ((y > 1) && (x > 1) && (a[x-1][y] == -1) && (a[x-1][y-1] == -1) && (a[x][y-1] == -1)) {
        a[x-1][y] = id;
        a[x-1][y-1] = id;
        a[x][y-1] = id;
        ++id;
    }

    Foo(x-1, y-1);
    Foo(x, y-1);
    Foo(x+1, y-1);
    Foo(x+1, y);
    Foo(x+1, y+1);
    Foo(x, y+1);
    Foo(x-1, y+1);
    Foo(x-1, y);
}

int main() {
    int n, x, y;
    scanf("%d %d %d", &n, &x, &y);

    sz = 1 << n;
    for (int i = 1; i <= sz; ++i)
        for (int j = 1; j <= sz; ++j)
            a[i][j] = -1;

    id = 1;
    a[x][y] = 0;
    Foo(x, y);

    for (int i = 1; i <= sz; ++i) {
        for (int j = 1; j <= sz; ++j)
            printf("%d\t", a[i][j]);
        printf("\n");
    }

    return 0;
}
